﻿$(function () {
    $('#navigation li').removeClass('active');
    $('#menu_selfTodayRecord').addClass('active');
    twiSelf.init();
    $('#checkInOut').click(function () {
        Twi.Ajax({
            data: {
                cn: 'SingleRecord',
                mn2: 'CheckInOut'
            },
            success: function (twi) {
                twiSelf.getTodayAllCheckedRecord();
                alert('打卡签到成功:' + twi.data);
            }
        });
    });
});

Twi.SCS.SelfTodayRecord =
{
    Vars: {}
    , init: function () {
        twiSelf.getTodayAllCheckedRecord();
    }
    , getTodayAllCheckedRecord: function () {
        Twi.Ajax({
            data:
            {
                cn: 'SingleRecord',
                mn2: 'GetTodayAllCheckedRecord'
            },
            success: function (twi) {
                if (twi.totalCount > 0) {
                    var list = JSON.parse(twi.data);
                    $('#record_item_container').html('');
                    for (var i = 0; i < list.length; i++) {
                        var itm = list[i];
                        $('#record_item_container').append('<div class="record_item"><span class="x_name">' + itm.FUserRealName + '</span><span class="x_time">' + itm.FTime + '</span></div>');
                    }
                }
            }
        });
    }
};

var twiSelf = Twi.SCS.SelfTodayRecord;
var twiVars = twiSelf.Vars;